<template>
	<view class="main"
		style="margin-top: 4vw;background: #fff; border-radius: 2vw;display: block;float: left;overflow: hidden;">
		<view class="shop-wrap" v-for="(shopInfo,index) of shopList" :key="index">
			<view class="shop-item">店铺名称：<text>{{shopInfo.mchName}}</text></view>
			<view class="shop-item">电话：<text>{{shopInfo.user.phone}}</text></view>
			<view class="shop-item flex-item"><view style="width: 70upx;font-size: 30upx;white-space: nowrap;">位置：</view><text style="flex: 1;"> {{shopInfo.addressName}}</text></view>
			<view @click="preview(shopInfo.domain + shopInfo.localPath)">
				<image :src="shopInfo.domain + shopInfo.localPath" mode="aspectFill"></image>
			</view>
			<view class="shop-item">微信进件：<text>{{getStatusName(shopInfo.wechatPayStatus)}}</text></view>
			<view class="shop-item">支付宝进件：<text>{{getStatusName(shopInfo.aliPayStatus)}}</text></view>
			<view class="shop-item" style="display: flex;justify-content: space-around;">
				<!-- <button type="warn" size="mini" style="margin-right: 20rpx;" @click="onAdClick(shopInfo.id)">广告收益</button>
				<button type="warn" size="mini" @click="onTradeClick(shopInfo.id)">流水收益</button> -->
				<view class="center_li" @click="onAdClick(shopInfo.id)">
					<text class="t24">广告明细</text>
					<text class="t11">{{shopInfo.adInc / 100}}元</text>
				</view>
				<view class="center_li" @click="onTradeClick(shopInfo.id)">
					<text class="t24">流水明细</text>
					<text class="t11">{{shopInfo.tradeInc / 100}}元</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mainid: '',
				shopList: [],
				total : 0,
				pages : 1
			}
		},
		onLoad() {
			var _this = this;
			uni.getStorage({
				key: 'user',
				success: function(res) {
					_this.mainid = res.data.id;
					_this.getSubject()
				}
			});
		},
		onReachBottom() {
			if(this.shopList.length < this.total){
				this.pages++;
				this.getSubject();
			}
		},
		onBackPress(e) {
			if (this.showMask) {
				this.showMask = false;
				return true;
			} else {
				uni.switchTab({
					url: '/pages/center/center'
				});
				return true
			}
		},
		methods: {
			onAdClick(id){
				uni.navigateTo({
					url: "/pages/statistics/statistics-ad?id=" + id
				});
			},
			onTradeClick(id) {
				uni.navigateTo({
					url: "/pages/statistics/statistics?id=" + id
				});
			},
			getStatusName(status){
				let statusName = "";
				switch(status) {
					case "-6":
				        statusName = "待签约";
				        break;
					case "-5":
				        statusName = "审核信息提交中";
				        break;
					case "-4":
				        statusName = "审核驳回";
				        break;
					case "-3":
				        statusName = "审核中";
				        break;
					case "-2":
					   statusName = "已禁用";
					   break;
					case "-1":
					   statusName = "已删除";
					   break;
					case "0":
					   statusName = "停用中";
					   break;
					case "1":
					   statusName = "启用中";
					   break;
				} 
				return statusName;
			},
			//获取店铺信息
			getSubject(){
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getAllSubject/' + this.mainid + '/' + this.pages, //仅为示例，并非真实接口地址。
					method: 'post',
					data: {
						id: this.mainid, //	用户ID（mainId）		true	string
					},
					success: (res) => {
						console.log('店铺信息：',res)
						this.total = res.data.data.resultObj.total;
						this.shopList = this.shopList.concat(res.data.data.resultObj.records) ;
					}
				})
			},
			preview(url){
				uni.previewImage({
					urls:[url],
				})
			},
		}
	}
</script>

<style>
	.center_li {
		width:50%;
		height: auto;
		float: left;
		margin: 2vw 0;
		border-right: 1px solid #F2F2F2;
		margin-top: 5vw;
	}
	
	.center_li:last-child {
		border: none;
	}
	
	.center_li text {
		width: 100%;
		height: 6vw;
		line-height: 6vw;
		float: left;
		text-align: center;
	}
	
	.ind_jiaoyi_jian1 {
		width: 100%;
		height: auto;
		/* display: flex; */
		display: block;
		float: left;
		padding: 5vw 3vw;
		padding-top: 10vw;
	}

	.ind_jiaoyi_jian2 {
		width: 90%;
		height: auto;
		/* display: flex; */
		display: block;
		float: left;
		padding: 5vw 3vw;
		padding-top: 10vw;
		box-shadow: 0px 0px 1vw #F2F2F2;
		padding-top: 5vw;
		border-radius: 2vw;
		margin: 0 5%;
		background: #fff;
		/* margin-bottom: 20vw; */
	}

	.shouyi3 {
		width: 82vw;
		height: 12vw;
		line-height: 12vw;
		text-align: center;
		background: #f19f5e;
		display: block;
		float: left;
		margin: 4vw;
		border-radius: 2vw;
		margin-bottom: 0;
	}

	.ind_jiaoyi_jian1_img {
		width: 14vw;
		height: auto;
		display: block;
		float: left;
		margin: 2vw 0;
		margin-left: 3vw;
	}

	.ind_jiaoyi_jian_t {
		width: 52vw;
		height: auto;
		display: block;
		float: left;
		margin-left: 4vw;
	}

	.ind_jiaoyi_jian_t text {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		line-height: 8vw;
	}

	.ind_next {
		width: 8vw;
		height: auto;
		display: block;
		float: right;
		margin-right: 3vw;
		margin-top: 7vw;
	}

	.ind_nav {
		/* width: auto; */
		width: 25%;
		height: auto;
		display: block;
		float: left;
		position: relative;
		padding-top: 14vw;
		padding-bottom: 5vw;
	}

	.ind_nav_image {
		width: 12vw;
		height: 12vw;
		padding: 3vw;
		display: block;
		float: left;
		background: #F1C75E;
		border-radius: 12vw;
		position: absolute;
		top: 0vw;
		left: 50%;
		box-shadow: 0px 0px 2vw #dfdfdf;
		margin-left: -6vw;
	}

	.ind_nav_image image {
		width: 100%;
		height: auto;
		display: block;
		float: left;
	}

	.ind_nav text {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		text-align: center;
	}

	.dp_kaig {
		width: 92%;
		height: auto;
		display: flex;
		justify-content: space-between;
		margin: 4vw 4%;
		float: left;
	}

	.dp_main {
		position: relative;
		padding: 4vw 0;
		float: left;
		width: 100%;
		height: auto;
		margin-bottom: 3vw;
		overflow: hidden;
	}

	.buts {
		width: 80%;
		height: 10vw;
		display: block;
		float: left;
		background: #F1C75E;
		text-align: center;
		line-height: 10vw;
		border-radius: 2vw;
		margin: 4vw 10%;
	}

	.center_qb {
		width: 100%;
		height: auto;
		line-height: 8vw;
		display: block;
		float: left;
		padding: 2vw 5vw;
		word-break: break-all;
	}

	.login_main_li_yzm {
		width: auto;
		height: 8vw;
		display: block;
		float: right;
		background: #fcbe16;
		padding: 0 3vw;
		line-height: 8vw;
		border-radius: 4vw;
	}

	.shuru {
		width: 100%;
		margin: 0 1vw;
		height: auto;
		display: block;
		float: left;
		border-radius: 2vw;
		overflow: hidden;
		padding: 2vw;
		background: #fff;
		box-shadow: 0px 0px 1vw #F2F2F2;
	}

	.shuru_tit {
		width: auto;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.shuru_text {
		width: 100%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	select.shuru_text {
		border: none;
	}



	.baodan_zhu {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 2vw 5%;
		background: #fff;
		border-radius: 2vw;
		padding: 4vw;
		box-shadow: 0px 0px 1vw #ccc;
		margin-top: 3vw;
	}

	.baodan_tit {
		width: 100%;
		height: 8vw;
		line-height: 8vw;
		display: block;
		float: left;
		text-align: center;
	}

	.baodan_into {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		line-height: 7vw;
		display: block;
		float: left;
		min-height: 40vw;
		background: url(../../static/img/jiaa.png) no-repeat center;
	}

	.baodan_into_image {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 0 5%;
	}

	.shuru_text1 {
		width: 100%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.shuru_text2 {
		background: url(../../static/img/turn.png) no-repeat right center;
		background-size: 3vw;
		line-height: 10vw;
		text-align: right;
		padding-right: 4vw;
	}

	.dp_but {
		width: auto;
		height: 7vw;
		line-height: 7vw;
		display: block;
		float: left;
		text-align: center;
		margin: 0vw 5vw;
		padding: 0 5vw;
		border-radius: 2vw;
		border: 1px solid #F1C75E;
	}
	.dp_but1 {
		width: auto;
		height: 7vw;
		line-height: 7vw;
		display: block;
		float: left;
		text-align: center;
		margin: 0vw 5vw;
		margin-right: 20vw;
		margin-bottom: 4vw;
		/* padding: 0 5vw; */
		text-decoration: underline;
		/* border-radius: 2vw; */
		/* border: 1px solid #F1C75E; */
	}
	.shop-wrap{
		background-color: white;
		border-bottom: 30upx solid #f6f6f6;
		margin-bottom: 30upx;
		padding: 10upx 30upx 40upx;
		height: auto;
	}
	.shop-wrap .shop-item{
		font-size: 30upx;
		/* height: 40upx; */
		line-height: 40upx;
		margin-top: 20upx;
	}
	.shop-wrap .shop-item text{
		color: #7A7A7A;
	}
	.shop-wrap image{
		width: 90%;
		height: 300upx;
		margin-top: 50upx;
	}
	.flex-item{
		display: flex;
		flex-direction: row;
	}
</style>
